package com.example.basicquestions.questions.单词反转;

import java.util.*;

/**
 * @author liw
 * @date 2023-03-10
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String string = scanner.nextLine();

        String tmp = "";
        String res = "";
        for(int i = 0; i < string.length(); i++) {
            char c = string.charAt(i);

            if(Character.isLetter(c)) {
                tmp+=c;
            }else if(c == ' '){
                res+=reverse(tmp) + " ";
                tmp = "";
            }else{
                res+=reverse(tmp);
                res+=c;
                tmp = "";
            }
        }
        System.out.println(res);

    }

    public static String reverse(String s){
        StringBuffer sb = new StringBuffer(s);
        String re = sb.reverse().toString();
        return re;
    }
}
